<%--
  Created by IntelliJ IDEA.
  User: Ningziyi
  Date: 2022/10/27
  Time: 18:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/personal_center.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/head_daohang.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.6.0.min.js"></script>
</head>
<body>
<!-- 主要布局范围 -->
<div class="main">
    <!-- 头部导航栏 -->
    <div id="head">
        <div class="layui-col-md2">
            <div class="grid-demo ">
                <div class="head-logo"></div>
            </div>
        </div>
        <div class="layui-col-md2">
            <div class="grid-demo head-demo"><a href="${pageContext.request.contextPath}/index.jsp" class="word-1">首页</a></div>
        </div>
        <div class="layui-col-md2">
            <div class="grid-demo head-demo"><a href="${pageContext.request.contextPath}/car/getCarView" class="head-hover word-1">自驾租车</a>
            </div>
        </div>
        <%--    <div class="layui-col-md1">--%>
        <%--        <div class="grid-demo head-demo"><a href="${pageContext.request.contextPath}/long_time_older/long_time.jsp" class="head-hover word-1">长租专区</a>--%>
        <%--        </div>--%>
        <%--    </div>--%>
        <div class="layui-col-md2">
            <div class="grid-demo head-demo"><a href=" ${pageContext.request.contextPath}/carOutlets/carAllList" class="head-hover word-1">车型查询</a>
            </div>
        </div>
        <div class="layui-col-md2">
            <div class="grid-demo head-demo"><a href="${pageContext.request.contextPath}/Offline_outlets/Business_outlets.jsp" class="head-hover word-1">营业网点</a></div>
        </div>
        <%--    <div class="layui-col-md1">--%>
        <%--        <div class="grid-demo head-demo"><a href="" class="head-hover word-1">会员专区</a></div>--%>
        <%--    </div>--%>
        <div class="layui-col-md2">
            <div class="grid-demo head-demo1">
                <i class="login-icon"></i>
                <a href="${pageContext.request.contextPath}/login/login.jsp" class="head-color">登录/注册</a>
            </div>
            <div class="tel">
                <i class="tel-icon"></i>
                <span class="tel-num">110-119-1111</span>
            </div>
        </div>
    </div>
    <!-- 面包屑 -->
    <div class="crumbs">
        <div class="crumbs-bd">当前位置: <a href="${pageContext.request.contextPath}/customer/getId/${cust.custId}" class="crumbs-person">个人中心</a> > </div>
    </div>
    <!-- 主要内容 -->
    <div class="content">
        <div class="content-bd">
            <!-- 左侧导航栏 -->
            <div class="col-sub">
                <ul>
                    <div class="title">订单信息</div>
                    <li class="text"><a href=javascript:getMyAllOrders()>我的订单</a></li>
                    <%--                    <li class="text"><a href="${pageContext.request.contextPath}/customer/personalCenter-OtherOrler.jsp">他人代订</a></li>--%>
                    <%--                    <div class="title">会员信息</div>--%>
                    <%--                    <li class="text"><a href="">会员优惠</a></li>--%>
                    <%--                    <li class="text"><a href="">会员特权</a></li>--%>
                    <%--                    <li class="text"><a href="">会员积分</a></li>--%>
                    <div class="title">我的钱包</div>
                    <%--                    <li class="text"><a href="${pageContext.request.contextPath}/customer/personalCenter-AccountBalance.jsp">账户余额</a></li>--%>
                    <%--                    <li class="text"><a href="${pageContext.request.contextPath}/customer/personalCenter-Voucher.jsp">我的代金卷</a></li>--%>
                    <li class="text"><a href="javascript:method1()" class="mycoupon">我的优惠编码</a></li>
                    <div class="title">车辆喜好</div>
                    <li class="text"><a href="">车辆推荐</a></li>
                    <div class="title">个人资料</div>
                    <li class="text"><a href="${pageContext.request.contextPath}/customer/getId/${cust.custId}/get_info" class="customMessage">用户信息</a></li>
                    <li class="text"  onclick="return confirm('即将返回登录界面，确定吗？');"><a href="${pageContext.request.contextPath}/login/login.jsp" class="exit-token">账户注销</a></li>
                </ul>
            </div>
            <!-- 主要信息栏 -->
            <div class="col-main">
                <div class="Code-biaoti">车辆推荐</div>
<c:forEach var="hotCar" items="${hotCarData}" >
                <div class="car">
                    <div class="car-img"><img src="${hotCar.other1}" style="width: 270px" alt=""></div>
                    <div class="car-message">
                        <b>${hotCar.carName}</b><br>
                        <label>自动 2.0T | 三厢 |5座 | </label>
                        <a href="">车辆详情></a><br>
                        <div class="car-tag">
                            <div class="car-tag-1">时尚</div>
                            <div class="car-tag-1">运动</div>
                            <div class="car-tag-1">操控</div>
                            <div class="car-tag-1">蓝牙连接</div>
                        </div>
                    </div>
                    <div class="time-text">
<%--                        已经订购：<b>3 </b> 次--%>
                        <button class="buy-again"><a href="${pageContext.request.contextPath}/car/${hotCar.carId}">去订购</a></button>
                    </div>
                </div>
</c:forEach>
<%--                <c:forEach var="carview" items="${carsView.data}">--%>
<%--                    <div class="cars">--%>
<%--                        <div class="car">--%>
<%--                            <div class="car-img"><img src="${carview.imgPath}" alt="" style="width: 270px"></div>--%>
<%--                            <div class="car-message">--%>
<%--                                <b>${carview.carName}</b><br>--%>
<%--                                <label >${carview.carSeat}座/${carview.carCase}/${carview.carDisplacement}T</label>--%>
<%--                                <a href="">车辆详情></a><br>--%>
<%--                                <div class="car-tag">--%>
<%--                                    <div class="car-tag-1">时尚</div>--%>
<%--                                    <div class="car-tag-1">运动</div>--%>
<%--                                    <div class="car-tag-1">操控</div>--%>
<%--                                    <div class="car-tag-1">蓝牙连接</div>--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                            <div class="time-text">--%>
<%--                                <b class="time-text1">￥${carview.carPrice}</b>/日均--%>
<%--                                <a class="btn-yuding" href="${pageContext.request.contextPath}/car/${carview.carId}">--%>
<%--                                    <button class="buy-again">预定</button>--%>
<%--                                </a>--%>
<%--                            </div>--%>
<%--                        </div>--%>
<%--                    </div>--%>
<%--                </c:forEach>--%>
<%--                <div class="car">--%>
<%--                    <div class="car-img"><img src="${pageContext.request.contextPath}/images/pc-car2.png" alt=""></div>--%>
<%--                    <div class="car-message">--%>
<%--                        <b>荣威ERX5（混动）</b><br>--%>
<%--                        <label for="">自动 1.5T | SUV |5座 |  </label>--%>
<%--                        <a href="">车辆详情></a><br>--%>
<%--                        <div class="car-tag">--%>
<%--                            <div class="car-tag-1">倒车影像</div>--%>
<%--                            <div class="car-tag-1">新能源不限行</div>--%>
<%--                            <div class="car-tag-1">蓝牙连接</div>--%>
<%--                        </div>--%>
<%--                    </div>--%>
<%--                    <div class="time-text">--%>
<%--                        已经订购：<b>2 </b> 次--%>
<%--                        <button class="buy-again">再次订购</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="car">--%>
<%--                    <div class="car-img"><img src="${pageContext.request.contextPath}/images/pc-car3.png" alt=""></div>--%>
<%--                    <div class="car-message">--%>
<%--                        <b>奥迪A6L</b><br>--%>
<%--                        <label for="">自动 1.8T | 三厢 |5座 | </label>--%>
<%--                        <a href="">车辆详情></a><br>--%>
<%--                        <div class="car-tag">--%>
<%--                            <div class="car-tag-1">豪华</div>--%>
<%--                            <div class="car-tag-1">大气</div>--%>
<%--                            <div class="car-tag-1">舒适</div>--%>
<%--                            <div class="car-tag-1">蓝牙连接</div>--%>
<%--                            <div class="car-tag-1">CarPlay</div>--%>
<%--                            <div class="car-tag-1">倒车影像</div>--%>
<%--                        </div>--%>
<%--                    </div>--%>
<%--                    <div class="time-text">--%>
<%--                        已经订购：<b>5 </b> 次--%>
<%--                        <button class="buy-again">再次订购</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="car">--%>
<%--                    <div class="car-img"><img src="${pageContext.request.contextPath}/images/pc-car4.png" alt=""></div>--%>
<%--                    <div class="car-message">--%>
<%--                        <b>荣威550混动</b><br>--%>
<%--                        <label for="">自动 1.5L | 三厢 |5座 | </label>--%>
<%--                        <a href="">车辆详情></a><br>--%>
<%--                        <div class="car-tag">--%>
<%--                            <div class="car-tag-1">实惠</div>--%>
<%--                            <div class="car-tag-1">新能源</div>--%>
<%--                        </div>--%>
<%--                    </div>--%>
<%--                    <div class="time-text">--%>
<%--                        已经订购：<b>1 </b> 次--%>
<%--                        <button class="buy-again">再次订购</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
            </div>
        </div>

    </div>
    <!-- 尾部 -->
    <div class="footer">
        <div class="footer-box">
            <div class="footer-left">
                <p>
                    <span>关于无忧</span> |
                    <span>移动客户端</span> |
                    <span>帮助中心</span> |
                    <span>建议专区</span> |
                    <span>联系我们</span> |
                    <span>友情连接</span> |
                    <span>投诉通道：400-821-1608</span>
                </p>
                <p>
                    <span>Copyright © 2007-2022 苏州无忧信息技术服务有限公司 ICP证：苏B2-20140130|苏ICP备08010394号-1</span>
                </p>
            </div>
            <div class="footer-right"></div>
        </div>
    </div>
</div>
<script src="${pageContext.request.contextPath}/js/personal_center.js"></script>
<script>
    loadInitData();
    // 查询我的所有订单
    function getMyAllOrders(){
        var token = localStorage.getItem("token");
        location.href="${pageContext.request.contextPath}/orders/getOrdersByCustomerId/"+token;
    }

    function  method1() {
        console.log("点击")
        var token  = localStorage.getItem("token");
        location.href="${pageContext.request.contextPath}/customercoupon/getall?token="+token;
        // $(".mycoupon").attr("href","customercoupon/getall?token="+token);

    }
    function loadInitData(){
        console.log("00000000000000")
        var token = localStorage.getItem("token");
        // ----->cpmtollrt toke 你=-----
        console.log("token-----:"+token)

        $.ajax({
            type: "get",
            url: "${pageContext.request.contextPath}/customer/personalData",
            headers: {"token": token},
            success: function (result) {
                console.log(result);
                var loginUser = result.data.loginCustomer;

                if(loginUser != null) {
                    $(".head-color").text(loginUser.custName);
                    $(".head-color").attr("href", "");
                    $(".customMessage").attr("href","${pageContext.request.contextPath}/customer/getId/"+loginUser.custId + "/get_info");
                    $(".crumbs-person").attr("href","${pageContext.request.contextPath}/customer/getId/" + loginUser.custId)
                }else{
                    console.log("2222222")
                    $(".head-color").text("登录");
                    $(".head-color").attr("href", "login/login.jsp");
                }
            }
        })
    }
</script>
</body>
</html>
